package demo1;

abstract class Shape {
    public abstract void draw();

}
class Rect extends Shape {


    @Override
    public void draw() {
        System.out.println("画矩形！");
    }
}
class Cycle extends Shape{

    @Override
    public void draw() {
        System.out.println("画圆!");
    }
}
class Flower extends Shape {

    @Override
    public void draw() {
        System.out.println("画❀!");
    }
}

public class Test2 {
    public static void drawMap(Shape shape) {
        shape.draw();
    }
    public static void main(String[] args) {
        //Shape shape = new Cycle();
        Cycle cycle = new Cycle();
        Flower flower = new Flower();

        drawMap(cycle);
        drawMap(flower);
        System.out.println("=================");
        Shape[] shapes = {cycle,flower};
        for(Shape shape : shapes) {
            shape.draw();
        }
    }
}
